package com.onpositive.notes.impl;

import java.io.Serializable;

import com.onpositive.notes.model.INote;
import com.onpositive.notes.model.INoteEntry;
import com.onpositive.notes.services.BasicNoteRegistry;

public abstract class AbstractNoteEntry implements INoteEntry {

	public AbstractNoteEntry() {
		super();
	}

	private static final long serialVersionUID = 6266609268437646876L;

	public AbstractNoteEntry(int start, int end) {
		super();
		this.start = start;
		this.end = end;
	}

	private int start ;
	private int end ;
	private int noteId;
	private int id ;

	@Override
	public int getStart() {
		return start;
	}

	@Override
	public int getEnd() {
		return end;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public void setEnd(int end) {
		this.end = end;
	}
	
	@Override
	public int compareTo(INoteEntry arg0) {
		return this.getStart() - arg0.getStart() ;
	}	

	@Override
	public INote getNote() {
		return BasicNoteRegistry.getInstance().getNote(noteId) ;
	}
	
	@Override
	public void setNoteId( int noteId ) {
		this.noteId = noteId ;
	}
	
	@Override
	public int getNoteId(){
		return noteId ;
	}
	
	@Override
	public void setId( int id ) {
		this.id = id ;
	}
	
	@Override
	public int getId(){
		return id ;
	}

}
